<?php
// +----------------------------------------------------------------------
// | Copyright (c) 2020 All rights reserved.
// +----------------------------------------------------------------------
// | User: Simony <1362229026@qq.com>
// | wechat: Shen86579595
// +----------------------------------------------------------------------

namespace app\common\model\view;

use app\common\model\Base;

use think\db;

class ViewLog extends Base
{
    protected $name = 'view_log';


    public function getViewLogList($condition = [], $page = -1, $field = '*', $order = 'v_l.id asc')
    {


        if ($page == -1) $page = config('paginate.list_rows');

        $res = $this->alias('v_l')
            ->where($condition)
            ->join('member m1', 'm1.id=v_l.member_id', 'left')
            ->join('member m2', 'm2.id=v_l.been_member_id', 'left')
            ->field($field)
            ->order($order);

        if ($page == 0) {
            $res = $res->select()->toArray();
            return $res;
        } else {
            $res = $res->paginate($page, false, ['query' => request()->param()]);
            $this->page_info = $res;
            return $res->items();
        }
    }


}
